<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/27 0027
 * Time: 11:05
 */

namespace App\Helpers;

class Resources
{
    /**
     * 请求成功返回
     * @param string $message
     */
    public static function success($data = array(), $message = '请求成功')
    {
        $response = [
            'status' => 'success',
            'status_code' => 200,
            'error' => 0,
            'message' => $message,
            'data' => $data
        ];

        return response()->json($response, 200);
    }

    /**
     * 请求失败返回
     * @param string $message
     */
    public static function error($message = '请求失败')
    {
        $response = [
            'status' => 'failed',
            'status_code' => 200,
            'error' => 1,
            'message' => $message
        ];

        return response()->json($response, 200);
    }

}